﻿package com.schimanek.math 
{
	
	/**
	 * ...
	 * @author Gregor Schimanek
	 */
	public class MathUtils 
	{
		
		public function MathUtils() 
		{
			throw new Error("Do not Instanciate Util-Classes as they only provide static funtions and properties");
		}
		
		static public function randomRange(minimum:Number, maximum:Number):Number {
			if(maximum>minimum){
				return minimum + Math.random()*(maximum - minimum);
			}else {
				throw new Error("randomRange invalid range: " + maximum + " is not higher than " + minimum);
			}			
		}
		
		static public function degreesToRadians(deg:Number):Number {
			return Math.PI*deg/180;
		}
		
		static public function radiansToDegrees(rad:Number):Number {
			return rad*180/Math.PI;
		}
	}
	
}